package com.tanhua.dubbo.mappers;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tanhua.model.testpaper.SoulReport;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface SoulReportMapper extends BaseMapper<SoulReport> {

    @Select("SELECT * from tb_soul_report where user_id=#{userId} and created=#{created} ")
    SoulReport selectOneId(@Param("userId") Long userId, @Param("created") String created);

    @Select("select * from tb_soul_report where user_id=#{userId}")
    List<SoulReport> selectByUserIdList(@Param("userId") Long userId);
    //这里根据评分倒叙，查询前5条
    @Select("select user_id from tb_soul_report where appraise_id=#{appraiseId}  and paper_id=#{paperId}  and user_id != #{userId} order by score desc limit 5")
    List<Long> findSimilarUsers(@Param("appraiseId") Long appraiseId,@Param("paperId") Long paperId,@Param("userId") Long userId);
}
